package com.project.controller.petInfoController;

import com.github.pagehelper.PageInfo;
import com.project.bean.PetInfoBean;
import com.project.service.petInfoService.IPetInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/petInfo")
public class PetInfoController {
    @Autowired
    private IPetInfoService service;
    @RequestMapping("/findByItem")
    public PageInfo<PetInfoBean> findByItem(int pageNO, String city, String type){
        return service.findByItem(pageNO, city, type);
    }
    @RequestMapping("/findByName")
    public PageInfo<PetInfoBean> findByName(int pageNO,int userId){
        return service.findByName(pageNO, userId);
    }
    @RequestMapping("/del")
    public String del(int petId){
        service.del(petId);
        return "ok";
    }
    @RequestMapping("/add")
    public String add(PetInfoBean petInfo, int userId){
        service.add(petInfo,userId);
        return "ok";
    }
}
